<me:UIEKP x:Class="WPFExcelReport.TSEK02"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"   
                    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
                    xmlns:me="clr-namespace:WPFExcelReport"  
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"    
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"  
                    xmlns:LS="clr-namespace:WPFExcelReport;assembly=TLIEFDAT"  
                    xmlns:QTB="clr-namespace:WPFExcelReport;assembly=TICC_QUERYTB"  
                    x:Name="TV"   
                    Loaded="Window_Loaded"
     >
    <me:UIEKP.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:PreisConverter  x:Key="price"/>
    </me:UIEKP.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel >
            <WrapPanel>
                    <Grid Margin="0,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" FontSize="16"  Text="{Binding Source={Localization:Translate Word=品种:}}"/>
                        <ex:TXT72 Grid.Column="1" FontSize="16" Margin="5,0,0,0" MaxLength="20"  IsAutoClear="False" 
                              IsAutoEnter="False" Name="txtART" Panel.ZIndex="1" CharacterCasing="Upper"
                              Text="{Binding ART,Converter={StaticResource gb2312},ElementName=TV}"  KeyUp="Query_KeyUp"  Width="100" />
                    </Grid>
                    <Grid Margin="0,0,0,0"  VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <LS:TSLS02 Grid.Column="1" MinWidth="100" 
                                   KEY="{Binding Path=DES,ElementName=TV}" 
                                   IsEdit="True"
                                    Width="Auto" />
                    </Grid>
                    <Grid Margin="0,0,0,0"  >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock FontSize="16"  Text="{Binding Source={Localization:Translate Word=采购单}}"/>
                        <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="2"   IsAutoClear="False" 
                               IsAutoEnter="False"
                              CharacterCasing="Upper" Text="{Binding KRS,ElementName=TV}"  
                              KeyUp="Query_KeyUp" Width="30" />
                        <ex:TXT72 Grid.Column="2" FontSize="16" Margin="5,0,0,0" MaxLength="6"  IsAutoClear="True" 
                              IsAutoEnter="False"
                              Text="{Binding LFD,ElementName=TV}"  KeyUp="Query_KeyUp"  Width="90" />
                    </Grid>
                    <Button  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=查询}}"></TextBlock>
                    <Button   Grid.Column="0" Click="CloseEKPCommand" Height="20" Margin="5,0,0,0" Width="24" Visibility="Collapsed">
                        <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Refresh.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=关闭采购单}}" Visibility="Collapsed"></TextBlock>               
            </WrapPanel>
        </StackPanel>

        <DataGrid  Grid.Row="1" Grid.Column="0"
                   Grid.RowSpan="2"
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"
                   Name="dlgMaster"
                   ItemsSource="{Binding Source={StaticResource vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Header="" Binding="{Binding EKKAUFKRS}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=采购单}}" Binding="{Binding EKKAUFLFD}" Width="Auto"/>
                <DataGridTextColumn Header="" Binding="{Binding EKPAUFPOS}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=供应商}}" Binding="{Binding EKKLIEFNR,Converter={StaticResource pnum}}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=供应商名称}}" Binding="{Binding LSLIEFNA,Converter={StaticResource gb2312}}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=品种编号}}" Binding="{Binding PART,Converter={StaticResource gb2312}}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=色号}}" Binding="{Binding PFARBE,Converter={StaticResource gb2312}}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=订单数量}}" Binding="{Binding Path=EKPME1, Converter={StaticResource ResourceKey=d100}}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding Path=EKPME3,Converter={StaticResource d100}}" Header="{Binding Source={Localization:Translate Word=收货数量}}" Width="Auto" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=EKPMEEH}" Header="{Binding Source={Localization:Translate Word=单位}}" Width="80" MinWidth="30" />
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=销售单}}" Binding="{Binding ABAVKAUF}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=客户}}" Binding="{Binding CUSTOMER,Converter={StaticResource ResourceKey=gb2312}}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=交期}}" Binding="{Binding EKPLTERM}" Width="Auto"/>
                <DataGridTextColumn Binding="{Binding Path=EKPGENDAT1}" Header="{Binding Source={Localization:Translate Word=船样}}" Width="80" MinWidth="30" />                

            </DataGrid.Columns>
        </DataGrid  >
        <ex:TPage  Grid.Row="2" Visibility="{Binding IsPage,Converter={StaticResource bv}}"/>
    </Grid> 
</me:UIEKP>
